1. Field of the Invention
The present invention relates to an information processing apparatus for performing reading from and writing to a storage apparatus, to a method of controlling the same and to a storage medium.
2. Description of the Related Art
Conventionally, there have been image forming apparatuses wherein an HDD (hard disk drive) is installed in the image forming apparatus, and as well as storing programs that the image forming apparatus executes in the HDD, a storage function for performing such things as saving image data in the HDD, and editing the saved images, is realized.
In recent years, increases in capacity and decreases in cost have progressed, and SSDs (Solid State Drives), which have rapidly spread along with the popularity of such things as mobile PCs, have come to be capable of performing faster random access than HDDs. Furthermore, SSDs are characterized as having low electric power consumption and high shock resistance, and being light weight and space economical. In particular, because on system start-up, initialization operation, such as a spinup operation necessary in the case of HDDs, is not necessary, shortening of system start-up time, together with high speed data transfer, has been highly anticipated.
However, NAND flash memory, which is a storage device, that is equipped in SSDs, has upper limits on the number of possible writes (for SLC, roughly 100,000 times, for MLC roughly 10,000 times). Furthermore, due to process miniaturization, there will be a tendency in flash memory for the number of possible rewrites to decrease from current levels in the future. This problem is mitigated by wear leveling techniques in which a flash memory controller installed in the SSD performs write destination averaging so that the frequency of writing is not concentrated on a particular region in order to increase the life span of the storage device. There are two main types of wear leveling: dynamic wear leveling and static wear leveling.
FIG. 5 is a view for explaining dynamic wear leveling.
Dynamic wear leveling is characterized as performing wear leveling in a range of physical memory allocated for a write addresses. Specifically, static data that is not frequently updated, such as an operating system (hereinafter OS) is saved in a read only region and left, and only dynamic data (new data) is scattered. So, because it is only performed on physical memory for necessary rewrites, it has the advantage that the number of rewrites can be suppressed, but on the other hand, it has the disadvantage that there is a possibility that the valid range for wear leveling will become narrower due to usage circumstances of the physical memory.
FIG. 6 is a view for explaining static wear leveling.
In static wear leveling, even for physical memory allocated to addresses to which writing was not performed, data is relocated and wear leveling is performed for all regions. Here, the number of rewrites is recorded for each block, and data writing is performed to a block having as few rewrites as possible. Also, as necessary, the data of a rewritten block (static data) is relocated to another block to attempt to equalize the numbers of writes. So, in contrast to dynamic wear leveling, static wear leveling has the advantage that there is no limit on the valid range of the wear leveling. However, it has the disadvantage that unnecessary rewrites to the physical memory occur frequently. In general, SSDs employ one of these two types of wear leveling, or use a combination of the two (for example, see Japanese Patent Laid-Open No. 2004-234473 and Japanese Patent Laid-Open No. 2009-093242).
Furthermore, in recent years, maintaining the security of data stored on storage devices installed in image forming apparatuses, and requirements regarding protection of privacy have been highly demanding, and it has been required that spool data and saved data stored in storage be completed deleted (hard deleted). However, while SSDs, unlike HDDs, can hard delete data with one rewrite, because of wear leveling, with standard write processing, data to be deleted cannot be directly rewritten, and so in order to hard delete the data, special write processing must be performed.
In SSDs that employ dynamic wear leveling, when there are a sufficient number of unused blocks in the installed flash memory, leveling functions extremely well, but when there are too few unused blocks, leveling stops functioning effectively. For example, when a disk copy to an SSD is performed with a copy tool such as a duplicator from a master disk, there are cases where a disk image of the master disk is copied to the entire range of the copy destination SSD. In such cases, the SSD to which the copy was performed enters a state in which data is written even to the physical blocks allocated to logically free regions as seen from the file system. In other words, from the perspective of a flash memory controller installed in the SSD, because all of the blocks are in a used state, dynamic wear leveling does not function effectively.
FIG. 7 is a view for showing an example of a 4 GB SSD wherein the SSD is in a state in which dynamic wear leveling has stopped functioning effectively. In FIG. 7, because data is written in a read only region, which is a valid data region, and to a logically free region, wear leveling is executed between a small unused region and rewrite region.
FIG. 8 is a view for showing a relationship between logical addresses and physical blocks of the SSD in the state shown in FIG. 7.
In a case where the SSD is embedded in a system and operated in this state, when an OS, or the like, performs concentrated rewrite processing on a particular region, because the wear leveling does not function effectively, there is a problem in that the life span of the physical blocks allocated to the particular region is exhausted extremely quickly.
In order to solve this kind of a problem, it is necessary to change the physical blocks allocated to the logically free regions from being in the used state to being unused blocks in an unused state. Generation of unused blocks, can be realized by performing rewrite processing of released data, after having written arbitrary data (dummy data) to the logically free region in the file system in a block unit, to the regions to which the dummy data was written. However, because processing speeds for write processing for flash memory are slow, in cases where the logically free region to be rewritten is large, there is a problem in that system performance is degraded due to the write processing.